import { http } from '@/utils/http/axios';
// 获取活动列表
export function getEvents(data) {
  const params = {};
  for (const key in data) {
    if (data[key] !== '') {
      params[key] = data[key];
    }
  }
  return http.request({
    url: '/events',
    method: 'get',
    params,
  });
}
// 获取活动详情
export function eventInfo(id) {
  return http.request({
    url: '/events/' + id,
    method: 'get',
  });
}

// 活动报名
export function signins(data) {
  return http.request({
    url: '/signins',
    method: 'post',
    data,
  });
}

// 根据活动ID, 获取用户签到的信息
export function getSignInfo(id) {
  return http.request({
    url: '/signin',
    method: 'get',
    params: {
      event_id: id,
    },
  });
}

// 获取省市列表
export function getCity() {
  return http.request(
    {
      url: '/common/city.json',
      method: 'get',
    },
    {
      apiUrl: 'https://static.huicanzhan.cn',
    }
  );
}

// 国籍
export function getNational() {
  return http.request(
    {
      url: '/common/state.json',
      method: 'get',
    },
    {
      apiUrl: 'https://static.huicanzhan.cn',
    }
  );
}

// 获取单位属性
export function getCompanyY() {
  return http.request({
    url: '/company-type-default',
    method: 'get',
  });
}

// 根据活动编号获取 活动报名配置信息
export function getRegisterConf(id) {
  return http.request({
    url: '/register',
    method: 'get',
    params: {
      event_id: id,
    },
  });
}

// 获取提示语
export function getHints(params) {
  return http.request({
    url: '/tips',
    method: 'get',
    params,
  });
}

// 活动类型
export function getEventType() {
  return http.request({
    url: '/industry-default',
    method: 'get',
  });
}
